package com.snowfeel.sfmall.sys.config;

import cloud.tianai.captcha.common.constant.CaptchaTypeConstant;
import cloud.tianai.captcha.resource.ResourceStore;
import cloud.tianai.captcha.resource.common.model.dto.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class CaptchaResourceConfiguration {

    @Autowired
    private ResourceStore resourceStore;

    @PostConstruct
    public void init() {
        // 2. 添加自定义背景图片
       resourceStore.addResource(CaptchaTypeConstant.SLIDER, new Resource("classpath", "bgimages/11.jpg", "default"));
       resourceStore.addResource(CaptchaTypeConstant.ROTATE, new Resource("classpath", "bgimages/12.jpg", "default"));
       resourceStore.addResource(CaptchaTypeConstant.CONCAT, new Resource("classpath", "bgimages/11.jpg", "default"));
       resourceStore.addResource(CaptchaTypeConstant.WORD_IMAGE_CLICK, new Resource("classpath", "bgimages/12.jpg", "default"));
    }
}
